<?php

namespace app\api\service;

use app\api\model\ZhExchange;

class ZhExchangeService
{
    /*
         * @Description  列表数据
         */
    public static function indexList($uid, $where, $field, $orderby, $limit, $page)
    {
        try {
            $res = ZhExchange::where($where)->where(function ($query) use ($uid) {
                $query->where('exchange_uid', '=', $uid)->whereOr('u_id', '=', $uid);
            })->field($field)->order($orderby)->paginate(['list_rows' => $limit, 'page' => $page])->toArray();
        } catch (\Exception $e) {
            abort(config('my.error_log_code'), $e->getMessage());
        }
        return ['list' => $res['data'], 'count' => $res['total']];
    }


}